package com.aldobucchi.x.flash.events.subscriber
{
	
	import mx.collections.IList;
	import mx.events.CollectionEvent;
	
	import com.aldobucchi.core.markers.IIncomplete;
	
	

	internal class EventSubscriptionListStep extends AbstractEventSubscriptionCollectionStep implements IIncomplete
	{
		
		
		
		/**
		 * we keep a private copy for speed
		 */		
		private var list:IList;
		
		
	
		/**
		 * 
		 * 
		 * @param listenerSpecs an array of com.aldobucchi.x.flash.events.EventListenerSpec objects
		 * 
		 */	
		public function EventSubscriptionListStep( target:IList, remainingSteps:Array )
		{


			super( target, remainingSteps );


			this.list = target;	
			


			list.addEventListener( CollectionEvent.COLLECTION_CHANGE, onListChange );
			
			var elements:Array = list.toArray( );

			for each ( var e:* in elements )
			{
				super.addSubElement( e );
			}

			
		}
		
		
		
		override internal function kill( ):void
		{
		
			list.removeEventListener( CollectionEvent.COLLECTION_CHANGE, onListChange );

			super.kill( );
		
		}
		

		
		
		
		private function onListChange( event:CollectionEvent ):void
		{

			// TODO
			
		}
		
		
		
		
	}
	

}